<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h2>ES6版本类继承</h2>
</body>
<script>
    //人类  
    class Person {
        constructor(name = '无名') {
            this.name = name
        }

        //添加原型方法
        getUserInfo() {
            return `我的名称叫${this.name}`
        }

    }


    //中国人
    class Chinese extends Person {
        constructor(name) {
            //借用构造函数继承
            super(name)
            this.theme = '黄皮肤'
        }

    }


    const c1 = new Chinese('张三111')
    console.log(c1.getUserInfo())
</script>

</html>